package org.speed.jdk;

import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeMap;

public class TreeMapDemo {
	
	public static void main(String[] args) {
		
		TreeMap<Integer, String> treeMap = new TreeMap<Integer, String>();
		
		treeMap.comparator();
		treeMap.put(2, "c");
		treeMap.put(1, "a");
		treeMap.put(0, "b");
		treeMap.put(3, "d");
		
		Set<Entry<Integer, String>> entrySet = treeMap.entrySet();
		for (Entry<Integer, String> entry : entrySet) {
			System.out.println(entry.getKey() + "," + entry.getValue());
		}
		
	}

}
